package view;

import java.awt.*;
import javax.swing.*;
import controller.Controller;
import model.visibility.PlayerView;
import view.controlScreen.ControlScreen;
import view.img.ImageLibrary;
import view.mainscreen.*;
import view.overview.StructureOverview;
import view.overview.TechOverview;
import view.overview.UnitOverview;


public class GameWindow extends JFrame //implements MouseListener
{ ImageLibrary imgLib = new ImageLibrary(); 
  private PlayerView playerView;
  private ScreenManager screenMan = new ScreenManager();
  //private Controller controls;
  private static MainScreen mainScreen;
  private static UnitOverview UOV;
  private static StructureOverview SOV;
  private static TechOverview TOV;
  private static ControlScreen controlScreen;
  
  public GameWindow(Dimension size, PlayerView _playerView, Controller controller)
  { playerView = _playerView;
	  mainScreen = new MainScreen(playerView, controller);
    UOV = new UnitOverview();
    SOV = new StructureOverview();
    TOV = new TechOverview();
    controlScreen = new ControlScreen();
    this.add(UOV); UOV.setControls(controller);
    this.add(SOV); SOV.setControls(controller);
    this.add(TOV); TOV.setControls(controller);
    this.setSize( size );
    this.setTitle( "SpiceRTS" );
    this.setResizable( false );
    this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    this.setVisible( true );
    screenMan.manage(this);
  }
  public static void switchToMainScreen()
  { ScreenManager.switchToScreen(mainScreen); }
  public static void switchToUOV()
  { ScreenManager.switchToScreen(UOV); }
  public static void switchToSOV()
  { ScreenManager.switchToScreen(SOV); }
  public static void switchToTOV()
  { ScreenManager.switchToScreen(TOV); }
  public static void switchToControlScreen()
  { ScreenManager.switchToScreen(controlScreen); }

  public AreaViewport getAreaViewport() 
  {	return mainScreen.getAreaViewport(); }
  public void refreshAreaViewport() 
  {	mainScreen.refreshAreaViewport(); }
/*  
  public void setControls(Controller controller) 
  { this.controls = controller; } 
*/  
}